/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

requirejs(['jquery', 'util', 'fancyBox', 'datatables', 'ztree', 'ztree_loader'], function($, util, fancyBox, dataTables, ztree, treeLoader) {
    
    $('#iframe_listproduct').css('height', $(window).height());
    
    // 加载完毕隐藏loading
    $('#iframe_listproduct').on('load', function() {
        window.setTimeout(function() {
            $('#iframe_loading').fadeOut();
        }, 500);
    });
    $('body').css('overflow', 'hidden');
    $('#categroys').css('height', $(window).height() - 20);

    // 目录树点击回调函数
    treeLoader.setting.callback.onClick = function(event, treeId, treeNode) {
        $('#iframe_loading').show();
        $('#iframe_listproduct').attr('src', '?/WdminPage/iframe_list_product/cat=' + treeNode.dataId);
    };
    
    // 初始化目录树
    treeLoader.init('#_ztree', '?/vProduct/ajaxGetCategroys/r=' + (new Date()).getTime(), function() {
        $('.fix_bottom').show();
    });

});